/**
 * lilang
 * ProcessInstanceService.java
 * 2013-10-25下午4:16:24
 */
package com.cq.oa.service.work;

import java.util.List;

import oa.base.service.BaseService;

import com.cq.oa.dao.wfc.TaskInstanceDao;
import com.cq.oa.domain.dto.TaskCmd;
import com.cq.oa.domain.dto.WorkDto;
import com.cq.oa.domain.wfc.Activity;
import com.cq.oa.domain.wfc.ActivityInstance;
import com.cq.oa.domain.wfc.ProcessInstance;
import com.cq.oa.domain.wfc.TaskInstance;

/**
 * @author lilang
 *
 */
public interface ProcessInstanceService extends BaseService<ProcessInstance>{

	
	public TaskInstanceDao getTaskInstanceDao();
	
	/**
	 * 启动工作流
	 * @param dto
	 * @return
	 * lilang 
	 * 2013-10-26下午2:23:43
	 */
	public ProcessInstance createProcessStart(WorkDto dto,String title);
	
	/**
	 * 更新流程实例信息
	 * @param businessId
	 * lilang 
	 * 2013-10-26下午2:32:36
	 */
	public void updateProcessTaskInfo(String businessId);
	
	/**
	 * 创建任务
	 * @param processInstance
	 * @return
	 * lilang 
	 * 2013-10-26下午3:00:54
	 */
	public TaskInstance createTask(ActivityInstance instance,Activity activity,TaskCmd cmd,String title);
	
	/**
	 * 创建隐藏任务任务
	 * @param processInstance
	 * @return
	 * lilang 
	 * 2013-10-26下午3:00:54
	 */
	public TaskInstance createHiddenTask(ActivityInstance instance,Activity activity,TaskCmd cmd,String title);
	
	/**
	 * 当前任务完成
	 * @param taskInstance
	 * lilang 
	 * 2013-10-30下午4:36:15
	 */
	public boolean doEndTask(TaskInstance taskInstance);
	
	/**
	 * 创建任务活动实例
	 * @param processInstance
	 * @return
	 * lilang 
	 * 2013-10-26下午3:02:40
	 */
	public ActivityInstance createActivityInstance(ProcessInstance processInstance,Activity activity,Integer taskNum);
	
	
	public ActivityInstance getActivityInstance(Long sid);
	/**
	 * 报错流程活动实例
	 * @param activityInstance
	 * lilang 
	 * 2013-10-26下午3:20:22
	 */
	public ActivityInstance doSaveActivity(ActivityInstance activityInstance);
	/**
	 * 保存任务
	 * @param taskInstances
	 * lilang 
	 * 2013-10-26下午3:20:48
	 */
	public void doSaveTask(List<TaskInstance> taskInstances);
	
	
	/**
	 * 更新任务实例状态
	 * @param activityInstanceId
	 * lilang 
	 * 2013-10-26下午2:32:36
	 */
	public void doUpdateTaskStatus(Long activityInstanceId);
	
}
